#include "roominterface.h"
#include "ui_roominterface.h"

roominterface::roominterface(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::roominterface)
{
    ui->setupUi(this);
    resize(1280,720);

    setWindowTitle("大富翁");
    QIcon windowicon(":/image/icon.jfif");
    setWindowIcon(windowicon);

    //设置qss样式
    QFile file(":/qss/roominterface.qss"); //通过文件路径创建文件对象
    file.open(QFile::ReadOnly); //文件打开方式
    QString str = file.readAll(); //获取qss中全部字符
    this->setStyleSheet(str); //设置样式表

    //背景图片
    QPalette PAllbackground = this->palette();
    QImage ImgAllbackground(":/image/roombackground.jfif");
    QImage fitimgpic=
            ImgAllbackground.scaled(this->width(),
                                    this->height(), Qt::IgnoreAspectRatio);
    PAllbackground.setBrush(QPalette::Window, QBrush(fitimgpic));
    this->setPalette(PAllbackground);

    //设置背景板
    board = new QTextBrowser(this);
    board->setObjectName("board");
    board->setGeometry(250,175,780,400);

    //设置玩家按钮
    player1 = new QPushButton(this);
    player2 = new QPushButton(this);
    player3 = new QPushButton(this);
    player4 = new QPushButton(this);
    player5 = new QPushButton(this);
    player6 = new QPushButton(this);
    player7 = new QPushButton(this);
    player8 = new QPushButton(this);

    player1->setObjectName("playerbutton");
    player2->setObjectName("playerbutton");
    player3->setObjectName("playerbutton");
    player4->setObjectName("playerbutton");
    player5->setObjectName("playerbutton");
    player6->setObjectName("playerbutton");
    player7->setObjectName("playerbutton");
    player8->setObjectName("playerbutton");

    player1->setGeometry(325,215,115,115);
    player2->setGeometry(490,215,115,115);
    player3->setGeometry(655,215,115,115);
    player4->setGeometry(820,215,115,115);
    player5->setGeometry(325,365,115,115);
    player6->setGeometry(490,365,115,115);
    player7->setGeometry(655,365,115,115);
    player8->setGeometry(820,365,115,115);

    player1->setText("玩家1");
    player2->setText("玩家2");
    player3->setText("玩家3");
    player4->setText("玩家4");
    player5->setText("玩家5");
    player6->setText("玩家6");
    player7->setText("玩家7");
    player8->setText("玩家8");

    startgame = new QPushButton(this);
    startgame->setObjectName("startgame");
    startgame->setText("开始游戏");
    startgame->setGeometry(518,495,225,65);

}

roominterface::~roominterface()
{
    delete ui;
}
